<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Persona filter form base class.
 *
 * @package    gestdent
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BasePersonaFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'nom_persona'      => new sfWidgetFormFilterInput(),
      'id_pais'          => new sfWidgetFormPropelChoice(array('model' => 'Pais', 'add_empty' => true)),
      'id_estado'        => new sfWidgetFormPropelChoice(array('model' => 'Estado', 'add_empty' => true)),
      'id_municipio'     => new sfWidgetFormPropelChoice(array('model' => 'Municipio', 'add_empty' => true)),
      'Observaciones'    => new sfWidgetFormFilterInput(),
      'fecha_nacimiento' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'status'           => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'nom_persona'      => new sfValidatorPass(array('required' => false)),
      'id_pais'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Pais', 'column' => 'id_pais')),
      'id_estado'        => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Estado', 'column' => 'id_estado')),
      'id_municipio'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Municipio', 'column' => 'id_municipio')),
      'Observaciones'    => new sfValidatorPass(array('required' => false)),
      'fecha_nacimiento' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'status'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('persona_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Persona';
  }

  public function getFields()
  {
    return array(
      'id_persona'       => 'Number',
      'nom_persona'      => 'Text',
      'id_pais'          => 'ForeignKey',
      'id_estado'        => 'ForeignKey',
      'id_municipio'     => 'ForeignKey',
      'Observaciones'    => 'Text',
      'fecha_nacimiento' => 'Date',
      'status'           => 'Number',
    );
  }
}
